{% extends "base.html" %}

{% block title %}HIT | Hegelian Inquiry Tool - Total summary{% endblock %}
{% block pagetitle %}Total summary{% endblock %}

{% block content %}
	{% if triangulation %}
		<h1>Summary of Hegelian Triangulation</h1><br />
		<div style="font-style: italic;">Date: {{ triangulation.date|date:"d/m/Y H:i" }}</div>
		<div style="font-style: italic;">Subject: {{ triangulation.subject }}</div>
		<br />
		{% if thesis %}
			<h2>Thesis triangulation</h2> <div class="reliability">Reliability: {{ thesis.reliability }}%</div><br /><br />
			Thesis:<br />
			<div class="text_no_scroll">
				{{ triangulation.thesis|linebreaksbr }}
			</div><br />
			Thesis link: <a href="{{ thesis.link }}" target="_blank">{{ thesis.link }}</a><br /><br />
			
			{% if thesis.data_result %}
				<h3>Data triangulation</h3> <div class="reliability">Reliability: {{ thesis.data_result.reliability }}%</div><br />
				<hr /><br /><br />
				<h4>Checked links:</h4><br />
				{% if thesis.data_result.links|length != 0 %}
					{% for l in thesis.data_result.links %}
						<a href="{{ l }}" target="_blank">{{ l }}</a><br />
					{% endfor %}
				{% else %}
					No links checked.<br />
				{% endif %}
				<br />
				<h4>Notes</h4><br />
				<div class="text">
				{{ thesis.data_result.notes|linebreaksbr }}
				</div><br />
			{% endif %}
			
			{% if thesis.investigator_result %}
				<h3>Investigator triangulation:</h3> <div class="reliability">Reliability: {{ thesis.investigator_result.reliability }}%</div><br />
				<hr /><br /><br />
				<h4>Checked links:</h4><br />
				{% if thesis.investigator_result.links|length != 0 %}
					{% for l in thesis.investigator_result.links %}
						<a href="{{ l }}" target="_blank">{{ l }}</a><br />
					{% endfor %}
				{% else %}
					No links about the author found.<br />
				{% endif %}
				<br />
				<h4>Additional information:</h4><br />
				<div class="text">
					{{ thesis.investigator_result.additional_info|linebreaksbr }}
				</div>
				<br /><br />
				
				<h4>Whois-results:</h4><br />
				<div class="text">
					{{ thesis.investigator_result.whoisdata|linebreaksbr }}
				</div>
				<br /><br />
				
				<h4>Notes</h4><br />
				<div class="text">
					{{ thesis.investigator_result.notes|linebreaksbr }}
				</div><br />
			{% endif %}
						
			{% if thesis.theory_result %}
				<h3>Theory triangulation:</h3> <div class="reliability">Reliability: {{ thesis.theory_result.reliability }}%</div><br />
				<hr /><br /><br />
				  <h1>Causal Network</h1>
<script type="text/javascript" src="/static/js/raphael-min.js"></script>
<script type="text/javascript" src="/static/js/dracula_graffle.js"></script>
<script type="text/javascript" src="/static/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/static/js/dracula_graph.js"></script>

<script type="text/javascript">
var redraw, g, renderer, g2, redraw2, renderer2;
window.onload = function() {
    var width = 900;
    var height = 900;    
    g = new Graph();
    
    {{thesis.alchemy1|safe}}
    
    /* layout the graph using the Spring layout implementation */
    var layouter = new Graph.Layout.Spring(g);    
    /* draw the graph using the RaphaelJS draw implementation */
    renderer = new Graph.Renderer.Raphael('canvas', g, width, height);    
    redraw = function() {
        layouter.layout();
        renderer.draw();
    };
    hide = function(id) {
        g.nodes[id].hide();
    };
    show = function(id) {
        g.nodes[id].show();
    };

	var width = 900;
    var height = 900;    
    g2 = new Graph();
    
    {{antithesis.alchemy2|safe}}
    
    /* layout the graph using the Spring layout implementation */
    var layouter2 = new Graph.Layout.Spring(g2);    
    /* draw the graph using the RaphaelJS draw implementation */
    renderer2 = new Graph.Renderer.Raphael('canvas2', g2, width, height);    
    redraw2 = function() {
        layouter2.layout();
        renderer2.draw();
    };
    hide = function(id) {
        g2.nodes[id].hide();
    };
    show = function(id) {
        g2.nodes[id].show();
    };

};
</script>
<div id="canvas"></div>
<button id="redraw" onclick="redraw();">redraw</button>
<br><br>
<h1>Sentiment Analysis</h1><br>
{{thesis.sentiment1|safe}}

				<h4>Notes</h4><br />
				<div class="text">
					{{ thesis.theory_result.notes|linebreaksbr }}
				</div><br />
			{% endif %}
			
			{% if thesis.method_result %}
				<h3>Method triangulation:</h3> <div class="reliability">Reliability: {{ thesis.method_result.reliability }}%</div><br />
				<hr /><br /><br />
				
				<h4>Methods:</h4><br />
				{% if thesis.method_result.methods|length != 0 %}
					<ul>
					{% for m in thesis.method_result.methods %}
						<li>{{  m }}</li>
					{% endfor %}
					</ul>
				{% else %}
					No methods checked.<br />
				{% endif %}
				<br />
				
				<h4>Notes</h4><br />
				<div class="text">
					{{ thesis.method_result.notes|linebreaksbr }}
				</div><br />
			{% endif %}
			
		{% endif %}
		
		{% if antithesis %}
			<h2>Antithesis triangulation</h2> <div class="reliability">Reliability: {{ antithesis.reliability }}%</div><br /><br />
			Antithesis:<br />
			<div class="text_no_scroll">
				{{ triangulation.antithesis|linebreaksbr }}
			</div><br />
			Antithesis link: <a href="{{ antithesis.link }}" target="_blank">{{ antithesis.link }}</a><br /><br />
			
			{% if antithesis.data_result %}
				<h3>Data triangulation</h3> <div class="reliability">Reliability: {{ antithesis.data_result.reliability }}%</div><br />
				<hr /><br /><br />
				<h4>Checked links:</h4><br />
				{% if antithesis.data_result.links|length != 0 %}
					{% for l in antithesis.data_result.links %}
						<a href="{{ l }}" target="_blank">{{ l }}</a><br />
					{% endfor %}
				{% else %}
					No links checked.<br />
				{% endif %}
				<br />
				<h4>Notes</h4><br />
				<div class="text">
				{{ antithesis.data_result.notes|linebreaksbr }}
				</div><br />
			{% endif %}
			
			{% if antithesis.investigator_result %}
				<h3>Investigator triangulation:</h3> <div class="reliability">Reliability: {{ antithesis.investigator_result.reliability }}%</div><br />
				<hr /><br /><br />
				<h4>Checked links:</h4><br />
				{% if antithesis.investigator_result.links|length != 0 %}
					{% for l in antithesis.investigator_result.links %}
						<a href="{{ l }}" target="_blank">{{ l }}</a><br />
					{% endfor %}
				{% else %}
					No links about the author found.<br />
				{% endif %}
				<br />
				<h4>Additional information:</h4><br />
				<div class="text">
					{{ antithesis.investigator_result.additional_info|linebreaksbr }}
				</div>
				<br /><br />
				
				<h4>Whois-results:</h4><br />
				<div class="text">
					{{ antithesis.investigator_result.whoisdata|linebreaksbr }}
				</div>
				<br /><br />
				
				<h4>Notes</h4><br />
				<div class="text">
					{{ antithesis.investigator_result.notes|linebreaksbr }}
				</div><br />
			{% endif %}
						
			{% if antithesis.theory_result %}
				<h3>Theory triangulation:</h3> <div class="reliability">Reliability: {{ antithesis.theory_result.reliability }}%</div><br />
				<hr /><br /><br />
				<h1>Causal Network</h1>

<div id="canvas2"></div>
<button id="redraw" onclick="redraw2();">redraw</button>
<br><br>
<h1>Sentiment Analysis</h1><br>
{{antithesis.sentiment2|safe}}
				<h4>Notes</h4><br />
				<div class="text">
					{{ antithesis.theory_result.notes|linebreaksbr }}
				</div><br />
			{% endif %}
			
			{% if antithesis.method_result %}
				<h3>Method triangulation:</h3> <div class="reliability">Reliability: {{ antithesis.method_result.reliability }}%</div><br />
				<hr /><br /><br />
				
				<h4>Methods:</h4><br />
				{% if antithesis.method_result.methods|length != 0 %}
					<ul>
					{% for m in antithesis.method_result.methods %}
						<li>{{  m }}</li>
					{% endfor %}
					</ul>
				{% else %}
					No methods checked.<br />
				{% endif %}
				<br />
				
				<h4>Notes</h4><br />
				<div class="text">
					{{ antithesis.method_result.notes|linebreaksbr }}
				</div><br />
			{% endif %}
			
		{% endif %}
		
		<h1>Synthesis</h1><br />
		<hr /><br /><br />
		<form method="POST" action="{% url HIT.Triangulator.views.save_synthesis %}" name="synthesisform">{% csrf_token %}
			{{ synthesisform.non_field_errors }}
			<div class="fieldWrapper">
				{{ synthesisform.synthesis.errors }}
				<label for="id_synthesis">Please enter your synthesis:</label><br />
				{{ synthesisform.synthesis }}
			</div>
			<div class="buttons">
				<span class="next"><input type="submit" value="Save" /></span>
			</div>
		</form>
		
	{% endif %}
{% endblock %}
